﻿package {
	import com.lang.views.ToolbarLang;
	import com.type.FunctionType;
	import com.utils.ChangeColor;
	import com.utils.Filter;
	import com.utils.Image;
	import com.utils.TextAnimation;
	import com.views.interfaces.IAlert;
	import com.views.interfaces.IMiniMap;
	import com.views.interfaces.ITip;
	import com.views.interfaces.IToolbar;

	import flash.display.*;
	import flash.events.*;
	import flash.geom.*;
	import flash.text.*;
	import flash.utils.*;
	import fl.events.ScrollEvent;
	import fl.controls.UIScrollBar;

	public class Toolbar extends Sprite implements IToolbar {

		public var _MiniMap:MCMiniMap; //instance name
		public var _FunctionLink:FunctionLink; //instance name
		public var _FunctionBar:FunctionBar; //instance name
		public var _PlayerData:MovieClip; //instance name
		public var _QuestTrace:MovieClip; //instance name
		private var _tip:ITip;
		private var _alert:IAlert;
		private var _goodsIconUrl:String;
		private var _addonsUrl:String;
		private var _ingotChange:ChangeColor;
		private var _coinChange:ChangeColor;
		private var soundOpenSign:String = "SoundOpen";
		private var soundMuteSign:String = "SoundMute";
		private var _PlayerDatalist:Array;
		private var _onSoundOpen:Function;
		private var _onSoundMute:Function;
		private var _onPlayerIcon:Function;
		private var _onRecharge:Function;
		private var _onAchievement:Function;
		private var _onBuyPower:Function;
		private var _light:Class;
		private var _video:MovieClip;
		private var _powerTimer:Timer;
		private var _isShowPower:Boolean = false;
		private var addMcPlayBool:Boolean = false;
		private var _powerFirst:int = 0;
		private var _maxPower:int = 0;
		private var _countPower:int = 0;
		private var _oldPower:int = 0;
		private var _newPower:int = 0;
		private var _increasePower:Boolean = false;
		private var _textAnimation:TextAnimation;
		private var _lastIngot:int = -1;
		private var _lastCoins:Number = -1;
		private var _isShowPlayerInfo:Boolean = false;
		private var _iconFile:TextField;
		private var _iconFrame:TextFormat;
		private var _onPlayerIconOver:Function;
		private var _isIconOver:Boolean = false;
		private var _onOpenRune:Function;
		private var _onDoubleRemoveBuff:Function;
		private var _buff:Buff;
		private var _textFormat;
		private var _intLinkY:int = 0;
		private var _objFunctionLink:Object;
		private var _onLinkTextClick:Function;
		private var _onLinkBtnClick:Function;
		private var _questTraceData:Object;
		private var _questTraceLink:Function;
		private var _questBackHeight:int = 30;
		private var _questAddonHeight:int = 10;
		private var _maxQuestLine:int = 5;
		private var _maxQuestCount:int = 3;
		private var _questScrollBar:UIScrollBar;
		private var _hasQuestScrollBar:Boolean;
		private var _questLines:Array;
		private var _expand:Boolean = true;
		private var _tabType:String = "accepted";
		private var _scrollVs:Object;
		private var _onQuest:Function;
		private var _onEnd:Function;
		private var _onBody:Function;
		private var _onPack:Function;
		private var _onUpgrade:Function;
		private var _onDeploy:Function;
		private var _onResearch:Function;
		private var _onFate:Function;
		private var _onSealSoul:Function;
		private var _onPetAnimal:Function;
		private var _onFriend:Function;
		private var _onFaction:Function;
		private var _onStudyStunt:Function;
		private var _onPractice:Function;
		private var _isFriendMessage:Boolean = false;
		private var _messageCount:int = 0;
		private var _showExpFile:Boolean = false;
		private var _onClickIgnore:Function;
		private var _aryFlowerImg:Array;
		private var _aryFlowerCount:Array;
		private var _blnInFlowerRainPlay:Boolean = false;
		private var _intFlowerRainHeight:int;
		private var _intFlowerRainWidth:int;
		private var _playerDataXY:Array;
		private var _functionLinkXY:Array;
		private var _miniMapXY:Array;
		private var _questTraceXY:Array;
		private var _functionBarXY:Array;
		private var _friendMessageXY:Array;

		public function Toolbar() {
			this._PlayerDatalist = ["PlayerIcon", this.soundOpenSign, this.soundMuteSign, "Recharge", "BuyPower"];
			this._onSoundOpen = new Function();
			this._onSoundMute = new Function();
			this._onPlayerIcon = new Function();
			this._onRecharge = new Function();
			this._onAchievement = new Function();
			this._onBuyPower = new Function();
			this._powerTimer = new Timer(0);
			this._onPlayerIconOver = new Function();
			this._onOpenRune = new Function();
			this._onDoubleRemoveBuff = new Function();
			this._textFormat = new TextFormat("", 12);
			this._objFunctionLink = {};
			this._onLinkTextClick = new Function();
			this._onLinkBtnClick = new Function();
			this._questLines = [];
			this._scrollVs = {accepted: 1, acceptable: 1};
			this._onQuest = new Function();
			this._onEnd = new Function();
			this._onBody = new Function();
			this._onPack = new Function();
			this._onUpgrade = new Function();
			this._onDeploy = new Function();
			this._onResearch = new Function();
			this._onFate = new Function();
			this._onSealSoul = new Function();
			this._onPetAnimal = new Function();
			this._onFriend = new Function();
			this._onFaction = new Function();
			this._onStudyStunt = new Function();
			this._onPractice = new Function();
			this._aryFlowerImg = [];
			this._aryFlowerCount = [10, 45, 45, 20];
			this._playerDataXY = [2, 3];
			this._functionLinkXY = [15, 125];
			this._miniMapXY = [809, 10];
			this._questTraceXY = [805, 123];
			this._functionBarXY = [320, 520];
			this._friendMessageXY = [846, 508];
			super();
			this._ingotChange = new ChangeColor();
			this._coinChange = new ChangeColor();
		}

		public function init():void {
			this.playerData();
			this.buff();
			this.questTrace();
			this.functionBar();
			this.showBarInfo();
			this.clickIgnore();
			this._powerTimer.addEventListener(TimerEvent.TIMER, this.onPowerEvent);
		}

		private function formatTextFormat(_arg1:TextField, _arg2:Boolean):void {
			var _local3:TextFormat = new TextFormat();
			_local3.font = "Tahoma";
			_local3.bold = _arg2;
			_arg1.setTextFormat(_local3);
		}

		public function clear():void {
		}

		public function set onSoundControl(_arg1:Function):void {
			this._onSoundOpen = _arg1;
			this._onSoundMute = _arg1;
		}

		public function set onPlayerIcon(_arg1:Function):void {
			this._onPlayerIcon = _arg1;
		}

		public function set onRecharge(_arg1:Function):void {
			this._onRecharge = _arg1;
		}

		public function set onAchievement(_arg1:Function):void {
			this._onAchievement = _arg1;
		}

		public function set nickName(_arg1:String):void {
			this._PlayerData._NickName.text = _arg1;
			this._PlayerData._NickName.setTextFormat(new TextFormat(null, null, null, true));
		}

		public function set onBuyPower(_arg1:Function):void {
			this._onBuyPower = _arg1;
		}

		public function playAchievementMc():void {
			this.loadFunctionBarEffect();
		}

		public function loadFunctionBarEffect():void {
		}

		public function health(_arg1:int, _arg2:int):void {
			var _local3:Number = (_arg1 / _arg2);
			if (_local3 < 0.5) {
				this._PlayerData._HpDownMc.visible = true;
			} else {
				this._PlayerData._HpDownMc.visible = false;
			}
			;
			this.progress("Health", 136, _arg1, _arg2, true);
			this.formatTextFormat(this._PlayerData["_Health"], true);
		}

		public function soundMute(_arg1:Boolean):void {
			this._MiniMap._SoundMute.visible = _arg1;
			this._MiniMap._SoundOpen.visible = !(_arg1);
		}

		public function power(_arg1:int, _arg2:int):void {
			this._oldPower = this._newPower;
			this._newPower = _arg1;
			this._maxPower = _arg2;
			this._PlayerData._BuyPower.visible = this._isShowPower;
			if (this._powerFirst == 0) {
				this._oldPower = this._newPower;
				this._countPower = this._newPower;
				this._powerFirst = 1;
			}
			;
			this._increasePower = (this._newPower >= this._oldPower);
			if (this.addMcPlayBool) {
				return;
			}
			;
			this.addMcPlayBool = true;
			this._powerTimer.start();
		}

		public function set powerVisible(_arg1:Boolean):void {
			this._isShowPower = _arg1;
			this._PlayerData._BuyPower.visible = _arg1;
		}

		public function set powerInfo(_arg1:Object):void {
			this._tip.addTarget(this._PlayerData._BuyPower, (("<font color=\"#f7941d\">" + _arg1.info) + "</font>"));
		}

		public function powerCount():void {
			var _local1:int = (this._newPower - this._oldPower);
			this._oldPower = this._newPower;
			if (_local1 == 0) {
				return;
			}
			;
			var _local2:TextAnimation = new TextAnimation();
			_local2.color = 0xFFF100;
			_local2.bold = true;
			_local2.target = this._PlayerData._PowerBtn;
			_local2.startAlphaNum = 10;
			_local2.speed = -1;
			if (_local1 > 0) {
				_local2.textInfo = (("+" + _local1) + ToolbarLang.Power);
			} else {
				_local2.textInfo = (_local1 + ToolbarLang.Power);
			}
			;
			_local2.start();
		}

		private function onPowerEvent(_arg1:TimerEvent):void {
			if ((((this._oldPower < this._newPower)) && ((true == this._increasePower)))) {
				this._oldPower = (this._oldPower + 3);
				if (this._oldPower > this._newPower) {
					this._oldPower = this._newPower;
				}
				;
			} else {
				if ((((this._oldPower > this._newPower)) && ((false == this._increasePower)))) {
					this._oldPower = (this._oldPower - 3);
					if (this._oldPower < this._newPower) {
						this._oldPower = this._newPower;
					}
					;
				}
				;
			}
			;
			if (this._oldPower == this._newPower) {
				this.addMcPlayBool = false;
				this._powerTimer.stop();
			}
			;
			this.progress("Power", 136, this._oldPower, 200, true);
		}

		private function progress(_arg1:String, _arg2:Number, _arg3:int, _arg4:int, _arg5:Boolean):void {
			_arg1 = ("_" + _arg1);
			var _local6:int;
			if (_arg3 > _arg4) {
				_local6 = _arg4;
			} else {
				_local6 = _arg3;
			}
			;
			this._PlayerData[(_arg1 + "Left")].visible = (_local6 > 0);
			this._PlayerData[(_arg1 + "Middle")].visible = (_local6 > 0);
			this._PlayerData[(_arg1 + "Right")].visible = (_local6 > 0);
			_arg2 = ((_arg2 - this._PlayerData[(_arg1 + "Left")].width) - this._PlayerData[(_arg1 + "Right")].width);
			this._PlayerData[(_arg1 + "Middle")].width = ((_local6 / _arg4) * _arg2);
			this._PlayerData[(_arg1 + "Right")].x = (this._PlayerData[(_arg1 + "Middle")].x + this._PlayerData[(_arg1 + "Middle")].width);
			if (_arg5) {
				this._PlayerData[_arg1].text = ((_arg3 + "/") + _arg4);
			} else {
				this._PlayerData[_arg1].text = _arg3;
			}
			;
			this.formatTextFormat(this._PlayerData[_arg1], true);
		}

		public function set level(_arg1:int):void {
			this._PlayerData._Level.text = _arg1;
		}

		public function set ingot(_arg1:int):void {
			this._tip.addTarget(this._PlayerData._Ingot, ((ToolbarLang.Ingot + " ") + _arg1));
			if (this._lastIngot == -1) {
				this._lastIngot = _arg1;
			}
			;
			var _local2:uint = ((this._lastIngot > _arg1)) ? 0xFF0000 : 0xFF00;
			this._ingotChange.textColorForIngot(this._PlayerData._Ingot, _arg1, _local2, 0xFFF200, 12);
			this._lastIngot = _arg1;
		}

		public function set coins(_arg1:Number):void {
			this._tip.addTarget(this._PlayerData._Coins, ((ToolbarLang.Coins + " ") + _arg1));
			if (Math.floor(this._lastCoins) == -1) {
				this._lastCoins = _arg1;
			}
			;
			var _local2:uint = ((this._lastCoins > _arg1)) ? 0xFF0000 : 0xFF00;
			this._coinChange.textColorForCoins(this._PlayerData._Coins, _arg1, _local2, 0xFFFFFF, 12);
			this._lastCoins = _arg1;
		}

		public function set PlayerInfo(_arg1:String):void {
			if (_arg1.length <= 0) {
				this._tip.removeTarget(this._PlayerData._PlayerIcon);
				this._isShowPlayerInfo = false;
			} else {
				if (this._isShowPlayerInfo == false) {
					this._tip.addTarget(this._PlayerData._PlayerIcon, this._iconFile);
					this._isShowPlayerInfo = true;
				}
				;
			}
			;
			this._iconFile.htmlText = _arg1;
			this._iconFile.setTextFormat(this._iconFrame);
		}

		public function iconFile():void {
			this._iconFile = new TextField();
			this._iconFile.autoSize = TextFieldAutoSize.LEFT;
			this._iconFrame = new TextFormat();
			this._iconFrame.leading = 8;
		}

		public function set onPlayerIconOver(_arg1:Function):void {
			this._onPlayerIconOver = _arg1;
		}

		private function playerData():void {
			var _local3:String;
			var _local4:String;
			var _local5:SimpleButton;
			this._PlayerData._NickName.selectable = false;
			this._PlayerData._Health.selectable = false;
			this._PlayerData._Level.selectable = false;
			this._PlayerData._Ingot.selectable = false;
			this._PlayerData._Coins.selectable = false;
			this._PlayerData._Power.selectable = false;
			this._MiniMap._SoundMute.visible = false;
			this._PlayerData._HealthTip.visible = false;
			var _local1:uint = this._PlayerDatalist.length;
			var _local2:uint;
			while (_local2 < _local1) {
				_local3 = this._PlayerDatalist[_local2];
				_local4 = ("_" + _local3);
				if (((!(this._PlayerData[_local4])) && (!(this._MiniMap[_local4])))) {
					throw(new Error((("名称为：" + _local4) + " 的影片剪辑不存在！")));
				}
				;
				if ((((_local3 == this.soundOpenSign)) || ((_local3 == this.soundMuteSign)))) {
					_local5 = this._MiniMap[_local4];
				} else {
					_local5 = this._PlayerData[_local4];
				}
				;
				_local5.addEventListener(MouseEvent.CLICK, this.getPlayerDataEventHandler(_local2));
				_local2++;
			}
			;
			this._PlayerData._PlayerIcon.addEventListener(MouseEvent.MOUSE_OVER, this.PlayerIconMouserOver);
			this._PlayerData._PlayerIcon.addEventListener(MouseEvent.MOUSE_OUT, this.PlayerIconMouserOut);
			this.iconFile();
			this._tip.addTarget(this._PlayerData._PlayerIcon, this._iconFile);
			this._tip.addTarget(this._MiniMap._SoundOpen, ToolbarLang.SoundOpenTip);
			this._tip.addTarget(this._MiniMap._SoundMute, ToolbarLang.SoundMuteTip);
			this._tip.addTarget(this._PlayerData._Level, ToolbarLang.LevelTip);
			this._tip.addTarget(this._PlayerData._Ingot, ToolbarLang.Ingot);
			this._tip.addTarget(this._PlayerData._Coins, ToolbarLang.Coins);
			this._tip.addTarget(this._PlayerData._HealthBtn, ToolbarLang.HealthTip);
			this._tip.addTarget(this._PlayerData._PowerBtn, ToolbarLang.PowerTip);
			this._tip.addTarget(this._PlayerData._Rune, ToolbarLang.RuneTip);
			this._tip.addTarget(this._QuestTrace._Quest, (ToolbarLang.Quest + "[Q]"));
			this.runes();
		}

		private function PlayerIconMouserOver(_arg1:MouseEvent):void {
			if (this._isIconOver == false) {
				this._onPlayerIconOver();
				this._isIconOver = true;
			}
			;
		}

		private function PlayerIconMouserOut(_arg1:MouseEvent):void {
			this._isIconOver = false;
		}

		private function getPlayerDataEventHandler(_arg1:uint):Function {
			var self:* = null;
			var index:* = _arg1;
			self = this;
			var func:* = function(_arg1:MouseEvent):void {
				var _local2 = self;
				_local2[("_on" + _PlayerDatalist[index])]();
			};
			return (func);
		}

		public function loadPlayerAvatar(_arg1:String):void {
			var _local2:Image = new Image(_arg1);
			this._PlayerData._PlayerAvatar.addChild(_local2);
		}

		public function set vipLevel(_arg1:int):void {
			this._PlayerData._VipLevel.visible = (_arg1 > 0);
			this._PlayerData._VipLevel.gotoAndStop(_arg1);
		}

		public function set rechargeVisible(_arg1:Boolean):void {
			this._PlayerData._Recharge.visible = _arg1;
		}

		public function set onOpenRune(_arg1:Function):void {
			this._onOpenRune = _arg1;
		}

		public function set runeVisible(_arg1:Boolean):void {
			this._PlayerData._Rune.visible = _arg1;
		}

		private function runes():void {
			this._PlayerData._Rune.addEventListener(MouseEvent.CLICK, this.onRuneClick);
		}

		private function onRuneClick(_arg1:MouseEvent):void {
			this._onOpenRune();
		}

		private function buff():void {
			this._buff = new Buff();
			addChild(this._buff);
			this._buff.tip = this._tip;
			this._buff.onDoubleRemoveBuff = function(_arg1:String):void {
				_onDoubleRemoveBuff(_arg1);
			};
		}

		public function set onDoubleRemoveBuff(_arg1:Function):void {
			this._onDoubleRemoveBuff = _arg1;
		}

		public function set addBuff(_arg1:Object):void {
			this._buff.addBuff = _arg1;
		}

		public function set visibleBuff(_arg1:Boolean):void {
			this._buff.visibleBuff = _arg1;
		}

		public function set removeBuff(_arg1:String):void {
			this._buff.removeBuff = _arg1;
		}

		public function renderFunctionLink(_arg1:Object):void {
			var _local2:FunctionLinkLabel;
			if (this._objFunctionLink.hasOwnProperty(_arg1["sign"])) {
				_local2 = (this._objFunctionLink[_arg1["sign"]] as FunctionLinkLabel);
				if (_arg1["stopText"] == "") {
					_local2._TextBtn.removeEventListener(MouseEvent.CLICK, this.linkTextBtnClickHandler);
					_local2._Btn.removeEventListener(MouseEvent.CLICK, this.linkBtnClickHandler);
					this._tip.removeTarget(_local2._TextBtn);
					this._tip.removeTarget(_local2._Btn);
					if (this._FunctionLink.contains(_local2)) {
						this._FunctionLink.removeChild(_local2);
					}
					;
					_local2 = null;
					delete this._objFunctionLink[_arg1["sign"]];
					return;
				}
				;
			} else {
				if (_arg1["stopText"] == "") {
					return;
				}
				;
				_local2 = new FunctionLinkLabel();
				_local2._Text.autoSize = TextFieldAutoSize.LEFT;
				_local2._Text.filters = [Filter.stroke];
				_local2._Text.setTextFormat(new TextFormat(""));
				_local2._TextBtn.addEventListener(MouseEvent.CLICK, this.linkTextBtnClickHandler);
				_local2._Btn.addEventListener(MouseEvent.CLICK, this.linkBtnClickHandler);
				_local2.y = this._intLinkY;
				this._FunctionLink.addChildAt(_local2, 0);
				this._intLinkY = (this._intLinkY + 20);
			}
			;
			if (_arg1["timeText"] == "") {
				_local2._Text.htmlText = _arg1["stopText"];
				_local2._Btn.visible = false;
			} else {
				_local2._Text.htmlText = (_arg1["runText"] + _arg1["timeText"]);
				_local2._Btn.x = ((_local2._Text.x + _local2._Text.width) + 4);
				_local2._Btn.visible = true;
			}
			;
			_local2._TextBtn.width = _local2._Text.width;
			_local2["sign"] = _arg1["sign"];
			_local2["index"] = _arg1["index"];
			_local2["time"] = _arg1["time"];
			this._objFunctionLink[_arg1["sign"]] = _local2;
		}

		public function renderFunctionLinkBtnTip(_arg1:String, _arg2:String):void {
			var _local3:FunctionLinkLabel = (this._objFunctionLink[_arg1] as FunctionLinkLabel);
			if (_local3 == null) {
				return;
			}
			;
			this._tip.addTarget(_local3._Btn, _arg2);
		}

		public function renderFunctionTextTip(_arg1:String, _arg2:String):void {
			var _local3:FunctionLinkLabel = (this._objFunctionLink[_arg1] as FunctionLinkLabel);
			if (_local3 == null) {
				return;
			}
			;
			this._tip.addTarget(_local3._TextBtn, _arg2);
		}

		public function setFunctionLinkPoint():void {
			var _local1:FunctionLinkLabel;
			var _local3:int;
			var _local4:int;
			this._intLinkY = 0;
			var _local2:Array = [];
			for each (_local1 in this._objFunctionLink) {
				_local2.push(_local1);
			}
			;
			_local2.sort(this.sortByFunctionLink);
			_local3 = 0;
			_local4 = 0;
			for each (_local1 in _local2) {
				_local1.y = this._intLinkY;
				this._intLinkY = (this._intLinkY + 20);
				var _temp1 = _local3;
				_local3 = (_local3 + 1);
				this._FunctionLink.setChildIndex(_local1, _temp1);
			}
			;
		}

		private function sortByFunctionLink(_arg1:Object, _arg2:Object):int {
			if (_arg1["index"] < _arg2["index"]) {
				return (-1);
			}
			;
			if (_arg1["index"] > _arg2["index"]) {
				return (1);
			}
			;
			if (_arg1["time"] < _arg2["time"]) {
				return (1);
			}
			;
			if (_arg1["time"] > _arg2["time"]) {
				return (-1);
			}
			;
			return (0);
		}

		private function linkTextBtnClickHandler(_arg1:MouseEvent):void {
			var _local2:SimpleButton = (_arg1.target as SimpleButton);
			var _local3:FunctionLinkLabel = (_local2.parent as FunctionLinkLabel);
			this._onLinkTextClick(_local3["sign"]);
		}

		private function linkBtnClickHandler(_arg1:MouseEvent):void {
			var _local2:SimpleButton = (_arg1.target as SimpleButton);
			var _local3:FunctionLinkLabel = (_local2.parent as FunctionLinkLabel);
			this._onLinkBtnClick(_local3["sign"]);
		}

		public function clearFunctionLink():void {
			var _local1:FunctionLinkLabel;
			for each (_local1 in this._objFunctionLink) {
				_local1._TextBtn.removeEventListener(MouseEvent.CLICK, this.linkTextBtnClickHandler);
				_local1._Btn.removeEventListener(MouseEvent.CLICK, this.linkBtnClickHandler);
				this._tip.removeTarget(_local1._TextBtn);
				this._tip.removeTarget(_local1._Btn);
				if (this._FunctionLink.contains(_local1)) {
					this._FunctionLink.removeChild(_local1);
				}
				;
			}
			;
			this._objFunctionLink = {};
			this._intLinkY = 0;
		}

		public function removeFunctionLink(_arg1:String):void {
			var _local2:FunctionLinkLabel;
			for each (_local2 in this._objFunctionLink) {
				if (_local2["sign"] == _arg1) {
					_local2._TextBtn.removeEventListener(MouseEvent.CLICK, this.linkTextBtnClickHandler);
					_local2._Btn.removeEventListener(MouseEvent.CLICK, this.linkBtnClickHandler);
					this._tip.removeTarget(_local2._TextBtn);
					this._tip.removeTarget(_local2._Btn);
					if (this._FunctionLink.contains(_local2)) {
						this._FunctionLink.removeChild(_local2);
					}
					;
					delete this._objFunctionLink[_arg1];
				}
				;
			}
			;
			this.setFunctionLinkPoint();
		}

		public function set onLinkTextClick(_arg1:Function):void {
			this._onLinkTextClick = _arg1;
		}

		public function set onLinkBtnClick(_arg1:Function):void {
			this._onLinkBtnClick = _arg1;
		}

		public function set onQuest(_arg1:Function):void {
			this._onQuest = _arg1;
		}

		public function set questTraceLink(_arg1:Function):void {
			this._questTraceLink = _arg1;
		}

		public function set questTraceTipVisible(_arg1:Boolean):void {
			if (_arg1) {
				this._tip.addTarget(this._QuestTrace._Trace, ToolbarLang.QuestTrace);
			} else {
				this._tip.removeTarget(this._QuestTrace._Trace);
			}
			;
		}

		private function questTrace():void {
			this._questScrollBar = this._QuestTrace._ScrollBar;
			this._questScrollBar.visible = false;
			this._QuestTrace._Accepted.buttonMode = true;
			this._QuestTrace._Accepted.useHandCursor = true;
			this._QuestTrace._Acceptable.buttonMode = true;
			this._QuestTrace._Acceptable.useHandCursor = true;
			this._QuestTrace._Expand.buttonMode = true;
			this._QuestTrace._Expand.useHandCursor = true;
			this._QuestTrace._Background.alpha = 0;
			this._QuestTrace._Background.height = this._questBackHeight;
			this._QuestTrace._Accepted.gotoAndStop(1);
			this._QuestTrace._Accepted.addEventListener(MouseEvent.CLICK, this.acceptedQuestHandler);
			this._QuestTrace._Acceptable.addEventListener(MouseEvent.CLICK, this.acceptableQuestHandler);
			this._QuestTrace._Quest.addEventListener(MouseEvent.CLICK, this.questClick);
			this._QuestTrace._Expand.addEventListener(MouseEvent.CLICK, this.expandQuestHandler);
			this._QuestTrace._Trace.filters = [Filter.stroke];
			this._QuestTrace._Trace.autoSize = TextFieldAutoSize.LEFT;
			this._QuestTrace._Trace.addEventListener(TextEvent.LINK, this.traceLinkHandler);
			this._QuestTrace.addEventListener(MouseEvent.MOUSE_OVER, this.questBackOver);
			this._QuestTrace.addEventListener(MouseEvent.MOUSE_OUT, this.questBackOut);
			this.questTraceTipVisible = true;
		}

		private function addScrollBarHandler():void {
			this._questScrollBar.addEventListener(ScrollEvent.SCROLL, this.questScrollBarHandler);
		}

		private function removeScrollBarHandler():void {
			this._questScrollBar.removeEventListener(ScrollEvent.SCROLL, this.questScrollBarHandler);
		}

		private function questScrollBarHandler(_arg1:ScrollEvent):void {
			this._scrollVs[this._tabType] = this._QuestTrace._Trace.scrollV;
		}

		public function renderQuestTrace(_arg1:Object):void {
			this._questTraceData = _arg1;
			if (false == this.questTraceVisible) {
				return;
			}
			;
			if (this._questTraceData["accepted"].length > 0) {
				this._tabType = "accepted";
				this.questTraceVisible = true;
				this.acceptedQuestHandler(null);
			} else {
				if (this._questTraceData["acceptable"].length > 0) {
					this._tabType = "acceptable";
					this.questTraceVisible = true;
					this.acceptableQuestHandler(null);
				} else {
					this.acceptedQuestHandler(null);
					this._QuestTrace._Trace.visible = false;
					this.questTraceVisible = false;
				}
				;
			}
			;
			this._questScrollBar.visible = false;
		}

		private function questClick(_arg1:MouseEvent):void {
			this._onQuest();
		}

		private function acceptedQuestHandler(_arg1:MouseEvent):void {
			this.removeScrollBarHandler();
			if (_arg1 != null) {
				if ("accepted" == this._tabType) {
					return;
				}
				;
				if ("acceptable" == this._tabType) {
					this._scrollVs[this._tabType] = this._QuestTrace._Trace.scrollV;
				}
				;
				this._expand = true;
				this._tabType = "accepted";
				this.expandQuest();
			}
			;
			this._QuestTrace._Accepted.gotoAndStop(1);
			this._QuestTrace._Acceptable.gotoAndStop(2);
			this.switchQuestTrace(this._tabType);
			this.addScrollBarHandler();
		}

		private function acceptableQuestHandler(_arg1:MouseEvent):void {
			this.removeScrollBarHandler();
			if (_arg1 != null) {
				if ("acceptable" == this._tabType) {
					return;
				}
				;
				if ("accepted" == this._tabType) {
					this._scrollVs[this._tabType] = this._QuestTrace._Trace.scrollV;
				}
				;
				this._expand = true;
				this._tabType = "acceptable";
				this.expandQuest();
			}
			;
			this._QuestTrace._Accepted.gotoAndStop(2);
			this._QuestTrace._Acceptable.gotoAndStop(1);
			this.switchQuestTrace(this._tabType);
			this.addScrollBarHandler();
		}

		private function switchQuestTrace(_arg1:String):void {
			var _local2:Array = [];
			var _local3:Array = this._questTraceData[_arg1];
			var _local4:int = _local3.length;
			this._questLines = [];
			var _local5:int;
			while (_local5 < _local4) {
				this._questLines.push((/<br>/.test(_local3[_local5])) ? 2 : 1);
				_local2.push(_local3[_local5]);
				_local5++;
			}
			;
			this._QuestTrace._Trace.htmlText = _local2.join("<br>");
			this._QuestTrace._Trace.visible = true;
			this.updateQuestScrollBar();
			this._questScrollBar.scrollTargetName = "_Trace";
			this._QuestTrace._Trace.scrollV = this._scrollVs[this._tabType];
		}

		private function get questLine():int {
			var _local2:Object;
			var _local1:int;
			for (_local2 in this._questLines) {
				_local1 = (_local1 + this._questLines[_local2]);
			}
			;
			return (_local1);
		}

		private function expandQuestHandler(_arg1:MouseEvent):void {
			this._expand = !(this._expand);
			this.expandQuest();
		}

		private function expandQuest():void {
			this._QuestTrace._Expand.gotoAndStop((this._expand) ? 1 : 2);
			this._QuestTrace._Trace.visible = this._expand;
			if (this._expand) {
				this.updateQuestScrollBar();
			} else {
				this._questScrollBar.visible = false;
				this.updateQuestHeight(this._questBackHeight);
			}
			;
			this._QuestTrace._Trace.scrollV = this._scrollVs[this._tabType];
		}

		private function traceLinkHandler(_arg1:TextEvent):void {
			this._questTraceLink(_arg1.text);
		}

		private function questBackOver(_arg1:MouseEvent):void {
			this._QuestTrace._Background.alpha = 1;
			if (this._expand) {
				this._questScrollBar.visible = this._hasQuestScrollBar;
			}
			;
		}

		private function questBackOut(_arg1:MouseEvent):void {
			this._QuestTrace._Background.alpha = 0;
			this._questScrollBar.visible = false;
		}

		private function updateQuestStatus():void {
			if (this.questLine > 0) {
				this._QuestTrace._Trace.visible = true;
				this.updateQuestHeight(((this._questBackHeight + this._QuestTrace._Trace.height) + this._questAddonHeight));
			} else {
				this._QuestTrace._Trace.visible = false;
				this.updateQuestHeight(this._questBackHeight);
			}
			;
		}

		private function updateQuestScrollBar():void {
			var _local1:Number;
			var _local2:String;
			var _local3:Boolean;
			this._QuestTrace._Trace.autoSize = TextFieldAutoSize.LEFT;
			if (this.questLine > this._maxQuestLine) {
				_local1 = ((this._QuestTrace._Trace.height / this.questLine) * this._maxQuestLine);
				_local3 = true;
				_local2 = TextFieldAutoSize.NONE;
			} else {
				_local1 = ((this.questLine > 0)) ? this._QuestTrace._Trace.height : 0;
				_local3 = false;
				_local2 = TextFieldAutoSize.LEFT;
			}
			;
			this._hasQuestScrollBar = _local3;
			this._QuestTrace._Trace.autoSize = _local2;
			this._QuestTrace._Trace.height = _local1;
			this._questScrollBar.visible = _local3;
			this._questScrollBar.height = _local1;
			this.updateQuestHeight(((this._questBackHeight + _local1) + ((_local1 > 0)) ? this._questAddonHeight : 0));
		}

		private function updateQuestHeight(_arg1:Number):void {
			this._QuestTrace._Background.height = _arg1;
		}

		public function newFunctionBar(_arg1:Array, _arg2:Array):void {
			this._FunctionBar.show(_arg1, _arg2);
		}

		public function getFunctionPoint(_arg1:String):Point {
			var _local2:Point = this._FunctionBar.getPointByType(_arg1);
			return (_local2);
		}

		public function set onEnd(_arg1:Function):void {
			this._onEnd = _arg1;
		}

		private function functionBar():void {
			var btnName:* = null;
			var w:* = NaN;
			var r:* = NaN;
			this._FunctionBar._FriendMessage.visible = false;
			var l:* = FunctionType.FullList;
			var len:* = l.length;
			var i:* = 0;
			while (i < len) {
				btnName = ("_" + l[i]);
				if (!(this._FunctionBar[btnName])) {
				} else {
					if (i == (len - 1)) {
						r = this._FunctionBar[btnName].x;
						w = this._FunctionBar[btnName].width;
					}
					;
					this._FunctionBar[btnName].visible = false;
					this._FunctionBar[btnName].addEventListener(MouseEvent.CLICK, this.getFunctionBarEventHandler(i, l));
				}
				;
				i = (i + 1);
			}
			;
			this._tip.addTarget(this._FunctionBar._Body, (ToolbarLang.Body + "[C]"));
			this._tip.addTarget(this._FunctionBar._Pack, (ToolbarLang.Pack + "[B]"));
			this._tip.addTarget(this._FunctionBar._Upgrade, (ToolbarLang.Upgrade + "[F]"));
			this._tip.addTarget(this._FunctionBar._Deploy, (ToolbarLang.Deploy + "[E]"));
			this._tip.addTarget(this._FunctionBar._Research, (ToolbarLang.Research + "[T]"));
			this._tip.addTarget(this._FunctionBar._Fate, (ToolbarLang.Fate + "[X]"));
			this._tip.addTarget(this._FunctionBar._StudyStunt, (ToolbarLang.StudyStunt + "[H]"));
			this._tip.addTarget(this._FunctionBar._SealSoul, (ToolbarLang.SealSoul + "[Y]"));
			this._tip.addTarget(this._FunctionBar._Achievement, (ToolbarLang.Achievement + "[P]"));
			this._tip.addTarget(this._FunctionBar._Friend, (ToolbarLang.Friend + "[V]"));
			this._tip.addTarget(this._FunctionBar._Faction, (ToolbarLang.Faction + "[G]"));
			this._tip.addTarget(this._FunctionBar._Practice, (ToolbarLang.Practice + "[Z]"));
			this._tip.addTarget(this._FunctionBar._ExperienceBtn, ToolbarLang.Experience);
			this._FunctionBar.onEnd = function():void {
				_onEnd();
			};
		}

		private function getFunctionBarEventHandler(_arg1:uint, _arg2:Array):Function {
			var self:* = null;
			var index:* = _arg1;
			var l:* = _arg2;
			self = this;
			var func:* = function(_arg1:MouseEvent):void {
				var _local2 = self;
				_local2[("_on" + l[index])]();
			};
			return (func);
		}

		public function set onBody(_arg1:Function):void {
			this._onBody = _arg1;
		}

		public function set onPack(_arg1:Function):void {
			this._onPack = _arg1;
		}

		public function set onUpgrade(_arg1:Function):void {
			this._onUpgrade = _arg1;
		}

		public function set onDeploy(_arg1:Function):void {
			this._onDeploy = _arg1;
		}

		public function set onResearch(_arg1:Function):void {
			this._onResearch = _arg1;
		}

		public function set onFate(_arg1:Function):void {
			this._onFate = _arg1;
		}

		public function set onSealSoul(_arg1:Function):void {
			this._onSealSoul = _arg1;
		}

		public function set onPetAnimal(_arg1:Function):void {
			this._onPetAnimal = _arg1;
		}

		public function set onFriend(_arg1:Function):void {
			this._onFriend = _arg1;
		}

		public function set onFaction(_arg1:Function):void {
			this._onFaction = _arg1;
		}

		public function set onStudyStunt(_arg1:Function):void {
			this._onStudyStunt = _arg1;
		}

		public function set onPractice(_arg1:Function):void {
			this._onPractice = _arg1;
		}

		public function updateExperience(_arg1:Number, _arg2:Number):void {
			this._FunctionBar._ExpLeft.visible = (_arg1 > 0);
			this._FunctionBar._ExpMiddle.visible = (_arg1 > 0);
			this._FunctionBar._ExpRight.visible = (_arg1 > 0);
			this._FunctionBar._Experience.htmlText = ["", _arg1, "/", _arg2, " (", (Math.floor(((1000 * _arg1) / _arg2)) / 10), "%)"].join("");
			this.formatTextFormat(this._FunctionBar._Experience, true);
			if (_arg1 == 0) {
				return;
			}
			;
			var _local3:Number = 668;
			_local3 = (_local3 - (this._FunctionBar._ExpLeft.width - this._FunctionBar._ExpRight.width));
			this._FunctionBar._ExpMiddle.width = ((_arg1 / _arg2) * _local3);
			this._FunctionBar._ExpRight.x = (this._FunctionBar._ExpMiddle.x + this._FunctionBar._ExpMiddle.width);
		}

		public function switchBubble(_arg1:int):void {
			this._messageCount = _arg1;
			if (_arg1 > 0) {
				if (FunctionType.isOpened(FunctionType.Friend)) {
					if (this._isFriendMessage == false) {
						this._FunctionBar.addChild(this._FunctionBar._FriendMessage);
						this._FunctionBar._FriendMessage.x = (this._FunctionBar._Friend.x - (this._FunctionBar._FriendMessage.width / 2));
						this._isFriendMessage = true;
					}
					;
					this._FunctionBar._FriendMessage.visible = true;
				}
				;
			} else {
				if (((this._FunctionBar._FriendMessage.parent) && (this._isFriendMessage))) {
					this._FunctionBar._FriendMessage.parent.removeChild(this._FunctionBar._FriendMessage);
					this._isFriendMessage = false;
				}
				;
			}
			;
		}

		public function set functionBarParent(_arg1:Sprite):void {
			if (_arg1) {
				_arg1.addChild(this._FunctionBar);
			} else {
				addChild(this._FunctionBar);
			}
		}

		private function showBarInfo():void {
			var _local4:TextField;
			var _local5:SimpleButton;
			var _local6:String;
			var _local1:Array = [[this._PlayerData._Health, this._PlayerData._HealthBtn, "Health"], [this._PlayerData._Power, this._PlayerData._PowerBtn, "Power"], [this._FunctionBar._Experience, this._FunctionBar._ExperienceBtn, "Exp"]];
			var _local2:uint = _local1.length;
			var _local3:uint;
			while (_local3 < _local2) {
				_local4 = _local1[_local3][0];
				_local5 = _local1[_local3][1];
				_local6 = _local1[_local3][2];
				_local4.visible = false;
				_local5.addEventListener(MouseEvent.MOUSE_OVER, this.infoHandler(_local4, _local6, true));
				_local5.addEventListener(MouseEvent.MOUSE_OUT, this.infoHandler(_local4, _local6, false));
				_local3++;
			}
			;
		}

		private function infoHandler(_arg1:TextField, _arg2:String, _arg3:Boolean):Function {
			var mc:* = _arg1;
			var sign:* = _arg2;
			var visible:* = _arg3;
			var func:* = function(_arg1:MouseEvent):void {
				mc.visible = visible;
			};
			return (func);
		}

		public function showExpFile(_arg1:Boolean):void {
			this._showExpFile = _arg1;
			this._FunctionBar._Experience.visible = _arg1;
		}

		public function addPackFull():void {
			this._FunctionBar.addPackFull();
		}

		public function removePackFull():void {
			this._FunctionBar.removePackFull();
		}

		public function updatePackMessageXY():void {
			this._FunctionBar.updatePackMessageXY();
		}

		private function clickIgnore():void {
		}

		private function clickIgnoreHandler(_arg1:MouseEvent):void {
			if ((this._onClickIgnore is Function)) {
				this._onClickIgnore(_arg1);
			}
			;
		}

		public function playFlowerRain(_arg1:String, _arg2:int, _arg3:int):void {
			var intCompleteCount:* = 0;
			var img:* = null;
			var url:* = _arg1;
			var intHeight:* = _arg2;
			var intWidth:* = _arg3;
			this._intFlowerRainHeight = intHeight;
			this._intFlowerRainWidth = intWidth;
			intCompleteCount = 0;
			var i:* = 1;
			while (i <= this._aryFlowerCount.length) {
				img = new Image(((url + i) + ".png"));
				img.onComplete = function():void {
					intCompleteCount++;
					if (intCompleteCount == _aryFlowerCount.length) {
						initFlowerRainCartoon(url);
					}
					;
				};
				i = (i + 1);
			}
			;
		}

		private function initFlowerRainCartoon(_arg1:String):void {
			var _local3:int;
			var _local4:Image;
			var _local5:Object;
			if (this._blnInFlowerRainPlay) {
				return;
			}
			;
			this._blnInFlowerRainPlay = true;
			var _local2:int = 1;
			while (_local2 <= this._aryFlowerCount.length) {
				_local3 = 0;
				while (_local3 < this._aryFlowerCount[(_local2 - 1)]) {
					_local4 = new Image(((_arg1 + _local2) + ".png"));
					_local4.x = (Math.random() * this._intFlowerRainWidth);
					_local4.y = ((Math.random() * this._intFlowerRainHeight) * -2);
					_local5 = {img: _local4, move: ((Math.ceil((Math.random() * 10)) > 5)) ? 1 : -1, oredr: Math.ceil((Math.random() * 1000))};
					this._aryFlowerImg.push(_local5);
					_local3++;
				}
				;
				_local2++;
			}
			;
			this._aryFlowerImg.sortOn("order", Array.NUMERIC);
			this.addEventListener(Event.ENTER_FRAME, this.onFlowerRainPlay);
		}

		private function onFlowerRainPlay(_arg1:Event):void {
			var _local3:Object;
			var _local4:Image;
			var _local5:Number;
			var _local2:Boolean = true;
			for each (_local3 in this._aryFlowerImg) {
				_local4 = (_local3["img"] as Image);
				_local5 = _local3["move"];
				if ((((((_local4.y > -50)) && (((_local4.y - 50) < this._intFlowerRainHeight)))) && (!(this.contains(_local4))))) {
					this.addChild(_local4);
				}
				;
				if ((_local4.y - 50) < this._intFlowerRainHeight) {
					_local4.x = (_local4.x + _local5);
					_local4.y = (_local4.y + 6);
					_local2 = false;
				} else {
					if (this.contains(_local4)) {
						this.removeChild(_local4);
					}
					;
				}
				;
			}
			;
			if (_local2) {
				this.removeEventListener(Event.ENTER_FRAME, this.onFlowerRainPlay);
				this._aryFlowerImg = [];
				this._blnInFlowerRainPlay = false;
			}
			;
		}

		public function reposition(_MinWidth:int, _MinHeight:int, _MaxWidth:int, _MaxHeight:int, _arg5:Point):void {
			_MaxWidth = Math.min(_MaxWidth, stage.stageWidth);
			_MaxHeight = Math.min(_MaxHeight, stage.stageHeight);
			this._MiniMap.x = Math.max((this._miniMapXY[0] - _arg5.x), (_MaxWidth - (_MinWidth - this._miniMapXY[0])));
			this._QuestTrace.x = Math.max((this._questTraceXY[0] - _arg5.x), (_MaxWidth - (_MinWidth - this._questTraceXY[0])));
			this._FunctionBar.x = Math.max((this._functionBarXY[0] - _arg5.x), (_MaxWidth - (_MinWidth - this._functionBarXY[0])));
			this._FunctionBar.y = Math.max((this._functionBarXY[1] - _arg5.y), (_MaxHeight - (_MinHeight - this._functionBarXY[1])));
			this.switchBubble(this._messageCount);
		}

		public function get content():Sprite {
			return (this);
		}

		public function set tip(_arg1:ITip):void {
			this._tip = _arg1;
		}

		public function set alert(_arg1:IAlert):void {
			this._alert = _arg1;
		}

		public function set goodsIconUrl(_arg1:String):void {
			this._goodsIconUrl = _arg1;
		}

		public function set addonsUrl(_arg1:String):void {
			this._addonsUrl = _arg1;
		}

		public function get addonsUrl():String {
			return (this._addonsUrl);
		}

		public function set playerDataVisible(_arg1:Boolean):void {
			this._PlayerData.visible = _arg1;
		}

		public function get playerDataVisible():Boolean {
			return (this._PlayerData.visible);
		}

		public function set functionLinkVisible(_arg1:Boolean):void {
			this._FunctionLink.visible = _arg1;
		}

		public function get functionLinkVisible():Boolean {
			return (this._FunctionLink.visible);
		}

		public function get questTraceVisible():Boolean {
			return (this._QuestTrace.visible);
		}

		public function set questTraceVisible(_arg1:Boolean):void {
			this._QuestTrace.visible = _arg1;
		}

		public function set functionBarVisible(_arg1:Boolean):void {
			this._FunctionBar.visible = _arg1;
		}

		public function get functionBarVisible():Boolean {
			return (this._FunctionBar.visible);
		}

		public function get miniMap():IMiniMap {
			return (this._MiniMap);
		}

		public function get questTraceContent():Sprite {
			return (this._QuestTrace);
		}

		public function set onClickIgnore(_arg1:Function):void {
			this._onClickIgnore = _arg1;
		}

	}
} //package 
